package com.eshop.service.Impl;

import com.eshop.dao.Impl.OrderDaoImpl;
import com.eshop.dao.Impl.OrderDetailDaoImpl;
import com.eshop.dao.OrderDao;
import com.eshop.dao.OrderDetailDao;
import com.eshop.model.Order;
import com.eshop.model.OrderDetail;
import com.eshop.model.myPojo.CartGoods;
import com.eshop.service.OrderService;

import java.util.List;

public class OrderServiceImpl implements OrderService {
    OrderDao orderDao = new OrderDaoImpl();
    OrderDetailDao orderDetailDao = new OrderDetailDaoImpl();

    @Override
    public Order getOrderByOrderId(int orderId) {
        return orderDao.queryOrderByOrderId(orderId);
    }

    @Override
    public Order getNewOrderByUserId(int userId) {
        return orderDao.queryNewOrderByUserId(userId);
    }

    @Override
    public List<Order> getOrderByUserId(int userId) {
        return orderDao.queryOrderByUserId(userId);
    }

    @Override
    public List<Order> getOrderByStatusAndUserId(int status, int userId) {
        return orderDao.queryOrderByStatusAndUserId(status,userId);
    }

    @Override
    public void addOrder(Order order) {
        orderDao.addOrder(order);
    }

    @Override
    public void updateOrderStatus(Order order) {
        orderDao.updateOrderStatus(order);
    }


    @Override
    public OrderDetail getOrderDetailByOrderDetailId(int orderDetailId) {
        return orderDetailDao.queryOrderDetailByOrderDetailId(orderDetailId);
    }

    @Override
    public List<OrderDetail> getOrderDetailByOrderId(int orderId) {
        return orderDetailDao.queryOrderDetailByOrderId(orderId);
    }

    @Override
    public void addOrderDetail(int orderId, CartGoods cartGoods) {
        orderDetailDao.addOrderDetail(orderId,cartGoods);
    }
}
